﻿/**
 * Copyright (c) 2008 Justin Etheredge http://www.codethinked.com
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Microsoft Public License (Ms-PL)
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/ms-pl.html
 * If redistributing this code, this entire header must remain intact.
 * 
 * Some of the code in this application has been taken 
 * from the following sources (all of which are licensed under
 * the Ms-PL):
 * Matt Warren's Blog: http://blogs.msdn.com/mattwar/
 * MSDN: http://msdn2.microsoft.com/en-us/library/bb546158.aspx
 */

using LinqToSimpleDB;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq.Expressions;
using System.Linq;
using System;

namespace LinqToSimpleDBTest
{
    
    
    /// <summary>
    ///This is a test class for SimpleDBQueryProviderTest and is intended
    ///to contain all SimpleDBQueryProviderTest Unit Tests
    ///</summary>
  [TestClass()]
  public class SimpleDBQueryProviderTest
  {


    private TestContext testContextInstance;

    /// <summary>
    ///Gets or sets the test context which provides
    ///information about and functionality for the current test run.
    ///</summary>
    public TestContext TestContext
    {
      get
      {
        return testContextInstance;
      }
      set
      {
        testContextInstance = value;
      }
    }

    #region Additional test attributes
    // 
    //You can use the following additional attributes as you write your tests:
    //
    //Use ClassInitialize to run code before running the first test in the class
    //[ClassInitialize()]
    //public static void MyClassInitialize(TestContext testContext)
    //{
    //}
    //
    //Use ClassCleanup to run code after all tests in a class have run
    //[ClassCleanup()]
    //public static void MyClassCleanup()
    //{
    //}
    //
    //Use TestInitialize to run code before running each test
    //[TestInitialize()]
    //public void MyTestInitialize()
    //{
    //}
    //
    //Use TestCleanup to run code after each test has run
    //[TestCleanup()]
    //public void MyTestCleanup()
    //{
    //}
    //
    #endregion


    /// <summary>
    ///A test for SimpleDBQueryProvider Constructor
    ///</summary>
    [TestMethod()]
    public void SimpleDBQueryProviderConstructorTest()
    {
      SimpleDBQueryProvider target = new SimpleDBQueryProvider();
      Assert.IsTrue(target.Domain == null);
      Assert.IsTrue(target.Precision == 0);
      Assert.IsTrue(target.Scale == 0);
    }

    /// <summary>
    ///A test for Scale
    ///</summary>
    [TestMethod()]
    public void ScaleTest()
    {
      SimpleDBQueryProvider target = new SimpleDBQueryProvider();
      int expected = 10;
      int actual;
      target.Scale = expected;
      actual = target.Scale;
      Assert.AreEqual(expected, actual);
    }

    /// <summary>
    ///A test for Precision
    ///</summary>
    [TestMethod()]
    public void PrecisionTest()
    {
      SimpleDBQueryProvider target = new SimpleDBQueryProvider();
      int expected = 20;
      int actual;
      target.Precision = expected;
      actual = target.Precision;
      Assert.AreEqual(expected, actual);     
    }

    /// <summary>
    ///A test for Domain
    ///</summary>
    [TestMethod()]
    public void DomainTest()
    {
      SimpleDBQueryProvider target = new SimpleDBQueryProvider();
      string expected = "TestDomain";
      string actual;
      target.Domain = expected;
      actual = target.Domain;
      Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    [ExpectedException(typeof(ArgumentNullException))]
    public void QueryProviderNullDomainTest()
    {
      SimpleDBQueryProvider provider = new SimpleDBQueryProvider(null);
    }
  }
}
